package com.wbcs.system.assistant;

import com.wbcs.util.Consts_Private;

public class DataImportAssistant
{
    private final static DataImportAssistant instance=new DataImportAssistant();
    
    private DataImportAssistant()
    {}
    
    public static DataImportAssistant getInstance()
    {
        return instance;
    }
    
    public String[] getRealFileNameAndImportType(String filename)
    {
        String[] resultsArr=new String[2];
        String realFileName=filename;
        String dynimporttypeTmp=null;
        if(filename.startsWith("["+Consts_Private.DATAIMPORTTYPE_APPEND+"]"))
        {
            realFileName=filename
                    .substring(("["+Consts_Private.DATAIMPORTTYPE_APPEND+"]").length()).trim();
            dynimporttypeTmp=Consts_Private.DATAIMPORTTYPE_APPEND;
        }else if(filename.startsWith("["+Consts_Private.DATAIMPORTTYPE_OVERWRITE+"]"))
        {
            realFileName=filename.substring(
                    ("["+Consts_Private.DATAIMPORTTYPE_OVERWRITE+"]").length()).trim();
            dynimporttypeTmp=Consts_Private.DATAIMPORTTYPE_OVERWRITE;
        }else if(filename.startsWith("["+Consts_Private.DATAIMPORTTYPE_DELETE+"]"))
        {
            realFileName=filename
                    .substring(("["+Consts_Private.DATAIMPORTTYPE_DELETE+"]").length()).trim();
            dynimporttypeTmp=Consts_Private.DATAIMPORTTYPE_DELETE;
        }
        resultsArr[0]=realFileName;
        resultsArr[1]=dynimporttypeTmp;
        return resultsArr;
    }
}

